#include <WiFiUdp.h>
#include "Arduino.h"

static WiFiUDP Udp;
static const char *host = "192.168.9.1";
static const int port = 11111;

void send_udp(){
    char msg[64];
    snprintf(msg, sizeof(msg), "Hello from ESP8266 UDP! millis=%lu", millis());
    Udp.beginPacket(host, port);
    Udp.write((const uint8_t*)msg, strlen(msg));
    int result = Udp.endPacket();
    Serial.printf("Sent %d bytes to %s:%d, result=%d\n",
                    strlen(msg), host, port, result);

    delay(100);
}